package de.gwtprime.shared;

import java.io.Serializable;
import java.util.Date;

public class Day implements Serializable, Comparable<Day> {

	
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 8082305433833540100L;
	
	private Date date;
	private Double openValue;
	private Double closeValue;
	
	private Double low;
	private Double high;
	
	private Double average200;
	
	private Double keltnerKanalOben = Double.MAX_VALUE;
	private Double keltnerKanalUnten = 0.0;
	
	private Double atr;
	
	private boolean buy = false;
	
	private boolean sell = false;
	
	public Day(){
		
	}
	public Day(Date date, Double closingPrice){
		this.setDate(date);
		this.setClosingPrice(closingPrice);
	}
	
	public Day(Date date, Double openValue, Double closingPrice){
		this.setDate(date);
		this.setOpenValue(openValue);
		this.setClosingPrice(closingPrice);
	}


	public Date getDate() {
		return date;
	}


	public void setDate(Date date) {
		
		// Add 12 hours to the date -> get 12 Uhr clock of this day
		this.date = new Date(date.getTime()+12*60*60*1000);
	}


	public Double getClosingPrice() {
		return closeValue;
	}


	public void setClosingPrice(Double closingPrice) {
		this.closeValue = closingPrice;
	}


	public Double getAverage200() {
		return average200;
	}


	public void setAverage200(Double average200) {
		this.average200 = average200;
	}
	public boolean isBuy() {
		return buy;
	}
	public void setBuy(boolean buy) {
		this.buy = buy;
	}
	public boolean isSell() {
		return sell;
	}
	public void setSell(boolean sell) {
		this.sell = sell;
	}
	public Double getOpenValue() {
		return openValue;
	}
	public void setOpenValue(Double openValue) {
		this.openValue = openValue;
	}
	public Double getLow() {
		return low;
	}
	public void setLow(Double low) {
		this.low = low;
	}
	public Double getHigh() {
		return high;
	}
	public void setHigh(Double high) {
		this.high = high;
	}
	public Double getKeltnerKanalUnten() {
		return keltnerKanalUnten;
	}
	public void setKeltnerKanalUnten(Double keltnerKanalUnten) {
		this.keltnerKanalUnten = keltnerKanalUnten;
	}
	public Double getKeltnerKanalOben() {
		return keltnerKanalOben;
	}
	public void setKeltnerKanalOben(Double keltnerKanalOben) {
		this.keltnerKanalOben = keltnerKanalOben;
	}
	@Override
	public int compareTo(Day o) {
		return getDate().compareTo(o.getDate()); // TODO make null safe
	}
	public Double getAtr() {
		return atr;
	}
	public void setAtr(Double atr) {
		this.atr = atr;
	}
}
